1. Field of the Invention
The present invention relates to an apparatus for processing image data and more particularly to an apparatus which processes image data read by an image reader.
2. Description of Prior Art
In a digital image forming apparatus such as a digital copying machine, an image of a document is formed on a paper after digital image data of the document are processed. The digital image data are generated by reading an image of a document with a linear CCD sensor or the like.
When a document is read by an image reader, it is put on a platen glass. When the document is put on the platen glass at an erroneous position, it is desirable to correct the tilt of the document. Then, a function is proposed to rotate 2-dimensional image data obtained by a document reader by the tilt angle of the document (for example, Japanese Patent Publication 63-9266/1988). The position of the document and the image area thereof are detected based on the digital image data. For example, Japanese Patent laid open Publication 62-166651/1987 shows that coordinates of four points locates at the maxima and the minima in the X and Y directions, and angles of the four sides connecting the four points are determined relative to a reference. Japanese Patent laid open Publication 7-298031/1995 shows that coordinates of four corners of a document are detected, and a tilt of the document is calculated from the corners detected first and second while the translation of the document is calculated from the corner detected first. In the tilt angle rotation, inclination of a document put on a platen glass is detected, and the image data are rotated to the normal position. Then, an image is formed on a paper based on the corrected image data. Thus, when a user puts a document at a tilt unintentionally, its image can be output by automatically correcting the tilt of the image.
However, in the prior art tilt correction by rotating the image data by the tilt angle, parameters needed for the tilt correction cannot be set when a document to be read is put erroneously to extend beyond the image reading area.
In the apparatuses described in Japanese Patent laid open Publications 62-166651/1987 and 7-298031/1995, the document area and the tilt of a rectangular document can be determined. However, the document area and the tilt of the document cannot be detected appropriately for a document having an extended portion or a non-rectangular document because the extended portion or the like is detected erroneously.
Further, in the above-mentioned apparatuses, the tilt of a document is detected based on the four points at the maxima or the minima or corners of a rectangular document. Then, the positions of the four points or corners may be detected erroneously, and the correct tilt may not be detected.
When an image of a document is read, a scanner is moved in the subscan direction to propagate a reflected light from the document to a liner CCD sensor or the like. However, the reading pitch in the subscan direction is unequal, the positions of the four corners or the like may be detected erroneously, and the slope and the document area cannot be detected correctly.
An object of the invention is to provide an image forming apparatus which can form an appropriate image of a document even when the document extends beyond the image reading area.
Another object of the invention is to provide a document detection apparatus which detects the position and the tilt of a document more precisely.
A further object of the invention is to provide a document detection apparatus which detects the position and the tilt of a document more precisely even if reading pitch is unequal.
In one aspect of the invention, an image processing apparatus comprises a document setter having an image reading area for reading a document put in the image reading area, and an image reader which reads the document put on the document setter. A detector detects an offset of the document from a standard position based on image data of the document read by the image reader. The detector includes a means for determining the area of the entire document based on a portion of the document which exists within the image reading area when the document extends beyond the image reading area. A moving means modifies the image data such that the determined document is moved to be located at a predetermined position when the offset of the document is detected by the detector. For example, the moving means comprises a rotator to rotate the image data. Further, the modified image data are formed on a paper. The document to be detected is for example rectangular. For example, the detector detects sides of the document and determines the tilt of the document on the document setter based on a longest side in the detected sides of the document.
In a second aspect of the invention, when a document is detected, a document is read by putting it on a document setter having an image reading area on which a document to be read. Edges of the document are extracted based on image data obtained by reading the document for the image reading area. Then, edges along the longest line are detected in lines of the document obtained from the extracted edges, and a slope of the document put on the document setter is determined based on the edges of the longest line.
In a third aspect of the invention, an image forming apparatus comprises a document setter having an image reading area for reading a document put in the image reading area, and an image reader which reads the document put on the document setter. A detector detects a document area of the document in the image reading area based on image data of the document read by said image reader. A rectangular area including the document area is determined, and a slope of the rectangular area is determined. A rotator rotates the image data included in the rectangular area to correct a tilt of the document, and a printer forms an image on a paper based on the image data rotated by the rotator.
In a fourth aspect of the invention, when a document is detected, a document put on a document setter having an image read area for reading a document put in the image reading area is read with a line sensor aligned in the main scan direction by moving a scanner in the subscan direction. Edges of the document are detected based on image data read on the document. Then, edges of lines having slopes equal to or smaller than 45xc2x0 relative to the subscan direction in the extracted edges are determined, and a tilt of the document is also detected based on the edges of the determined line.
An advantage of the present invention is that an image of a tilted document is corrected automatically if the document extends beyond the image reading area when it is read by an image reader.
Another advantage of the invention is that an image of a tilted document is corrected automatically for a document which is not rectangular.
A further advantage of the invention is that the tilt angle and the document area of a tilted document can be detected even if reading pitch is unequal when the document is read.